/**
 * Created by Administrator on 2016/12/20.
 */

$(function(){
    init();
});
/****初始化表格数据*******/
function init(){
   // console.log(JSON.parse(localStorage.getItem("contractor")));
 // var oData=JSON.parse(localStorage.getItem("contractor"));
    var oData = location.search;
   var arr1= oData.slice(1).split("&");
   // console.log(arr1);
    var result=[];
    for(var i=0;i<arr1.length;i++){
        if(i%4==0){
            var json={};
        }
        var arr2=arr1[i].split('=');
        json[arr2[0]]=decodeURI(arr2[1]);
        if(i%4==3){result.push(json)};
    }
    console.log(result);
    $('#contractorTable').bootstrapTable({
        data:result,
        onClickRow:function(row){
            sessionStorage.teamTypeInfo=JSON.stringify(row);
            console.log(row);
        }
    })
}
function responseHandler(res){
    console.log(res);
    var needData = {
        rows: res.data.list,//只 输出data,内容不会显示 在页面内。必须 加上.list;
        total: res.data.total
    };
    return needData;
}
function indexFmt(val,row,index){
    /*if($("table#contractorTable").data('bootstrap.table').options){
        var optionVar=$("table#contractorTable").data('bootstrap.table').options;
        var pageNum=optionVar.pageNumber;
        var pageSize=optionVar.pageSize;
        return (pageNum-1)*pageSize+index+1;
    }else{}
     */
        return index+1;

}

function pjTableQuery(params){
    params["pageNum"] = (params.offset / params.limit) + 1;
    params.pageSize = params.limit;
    return params;

}